package com.retail.shopping.server.service.impl;

import java.util.List;

import com.retail.shopping.common.domain.request.CartInsertRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.retail.shopping.server.mapper.ShoppingCartMapper;
import com.retail.shopping.common.domain.ShoppingCart;
import com.retail.shopping.server.service.IShoppingCartService;

/**
 * 购物车主Service业务层处理
 * 
 * @author retail
 * @date 2024-02-27
 */
@Service
public class ShoppingCartServiceImpl implements IShoppingCartService 
{
    @Autowired
    private ShoppingCartMapper shoppingCartMapper;

    /**
     * 查询购物车主
     * 
     * @param cartId 购物车主主键
     * @return 购物车主
     */
    @Override
    public ShoppingCart selectShoppingCartByCartId(Long cartId)
    {
        return shoppingCartMapper.selectShoppingCartByCartId(cartId);
    }

    /**
     * 查询购物车主列表
     * 
     * @param shoppingCart 购物车主
     * @return 购物车主
     */
    @Override
    public List<ShoppingCart> selectShoppingCartList(ShoppingCart shoppingCart)
    {
        return shoppingCartMapper.selectShoppingCartList(shoppingCart);
    }

    /**
     * 新增购物车主
     * 
     * @param shoppingCart 购物车主
     * @return 结果
     */
    @Override
    public int insertShoppingCart(ShoppingCart shoppingCart)
    {
        return shoppingCartMapper.insertShoppingCart(shoppingCart);
    }

    /**
     * 修改购物车主
     * 
     * @param shoppingCart 购物车主
     * @return 结果
     */
    @Override
    public int updateShoppingCart(ShoppingCart shoppingCart)
    {
        return shoppingCartMapper.updateShoppingCart(shoppingCart);
    }

    /**
     * 批量删除购物车主
     * 
     * @param cartIds 需要删除的购物车主主键
     * @return 结果
     */
    @Override
    public int deleteShoppingCartByCartIds(Long[] cartIds)
    {
        return shoppingCartMapper.deleteShoppingCartByCartIds(cartIds);
    }

    /**
     * 删除购物车主信息
     * 
     * @param cartId 购物车主主键
     * @return 结果
     */
    @Override
    public int deleteShoppingCartByCartId(Long cartId)
    {
        return shoppingCartMapper.deleteShoppingCartByCartId(cartId);
    }

    @Override
    public ShoppingCart selectShoppingFindByUserId(Integer userId) {
        return shoppingCartMapper.selectShoppingFindByUserId(userId);
    }

    @Override
    public int shoppingCartAdd(CartInsertRequest cartInsertRequest) {
       return shoppingCartMapper.shoppingCartAdd(cartInsertRequest);
    }

    @Override
    public List<ShoppingCart> selectShopCartFindByUserId(List<Integer> userIds) {
        return shoppingCartMapper.selectShopCartFindByUserId(userIds);
    }


}
